<% content_for :css do %>
  <%= stylesheet_link_tag 'top_hot_tools','sub_nav_bar','tools_index' %>
<% end %>
<% content_for :level_2_nav_bar do %>
  <ul>
    <li>
      <%= link_to "所有", tools_url, :class => ((params[:tool_type_id].blank?) ? 'h':'') %>
    </li>
    <% @tool_types.each do |tool_type| %>
    <li class='<%= @tool_types.last == tool_type ? 'last':''  %>'>
      <%= link_to tool_type.name, tools_url(:tool_type_id => tool_type.id), :class => (params[:tool_type_id].to_i== tool_type.id) ? 'h':'' %>
    </li>
    <% end %>
  </ul>
<% end %>
<div class='line'>
  <%= render :file => 'homes/_top_hot_tools.html', :locals => { :how_many => 10 } %>
  <div id="main">
    <div id="main_c">
      <div>
        <h1>精心为您准备的美味吐司大餐！ </h1>  
      </div>      
      <div class='tool'>
        <%= link_to "增加新吐司", new_tool_url if current_user.try(:admin?) %>
      </div>
      <div class="span-19 mt mb last top" id="itemlist_bar">
        <div class="span-7">
          <%= @tool_type.try(:name) %><b>共</b>有<b><%= @tools.size %></b>份吐司
          <% if has_logined_by_user? %>
          ，您<b class='eating'>正享用</b>着<b class='eating'><%= current_user.all_settings_by_tool_type_id(params[:tool_type_id]).size %></b>份(<%= link_to "看看都吃了些啥", user_url(current_user), :target => :_blank, :class => :h %>)。
          <% end %>
        </div>
        <%#*<div id='list_top_bar' class="span-11 last">%>
          <%#= check_box_tag 'show_or_hide_eated', :class => :no %><%#= label 'show_or_hide','eated', '已享用' %>
          <%#*<select onchange="javascript:submit()" name="o" id="o">%>
            <%#*<optgroup label="- 排序条件 -">%>
              <%#*<option value="4">使用度</option>%>
              <%#*<option value="4">关注度</option>%>
              <%#*<option value="1">吐司名称</option>%>
              <%#*<option selected="selected" value="3">出炉时间</option>%>
            <%#*</optgroup>%>
          <%#*</select>%>
        <%#*</div>%>
      </div>
      <div class="itemlist">
        <div class="itemlist1">
          <% @tools.each do |tool| %>
          <div class='<%= 'using' if tool.set_by_current_user? %> item'>
            <div id="item894">
              <% link_to tool_url(tool), :class => :b do %>
                <%= tool_logo_image_tag tool, :width => 120, :height => 130 %>
              <% end %>
            </div>
            <div class="list_name">
              <%= link_to tool.name, tool_url(tool), :class => :px12, :title => tool.title %>
            </div>
            <div class="stat">
              <b class="using">使用</b>：<b><%= tool.user_tool_settings_count %></b>人
            </div>
            <div class="stat">
              <b class="care">关注</b>：<b><%= tool.carers_count %></b>人
            </div>
            <div class="funcs">
              <%= supports_web if tool.support_web? %>
              <%= supports_sms if tool.support_sms? %>
              <%= supports_email if tool.support_email? %>
            </div>
            <div class='eating'>              
              <%= link_to "立即享用", tool_url(tool),:target => :_blank,:class => 'eating' %>
              <%= link_to "正在享用...", tool_url(tool),:target => :_blank,:class => 'has_eated' %>
            </div>
            <div class='using'>
              <%= image_tag "tools/fork.png", :size => '18x18', :alt => '正在享用', :title => '正在享用' %>
            </div>
          </div>          
          <% end %> 
        </div>
      </div>    
      <div class="span-19 mt mb last bottom" id="itemlist_bar">        
        <div class="span-7">
          <%= @tool_type.try(:name) %><b>共</b>有<b><%= @tools.size %></b>份吐司
          <% if has_logined_by_user? %>
          ，您<b class='eating'>正享用</b>着<b class='eating'><%= current_user.all_settings_by_tool_type_id(params[:tool_type_id]).size %></b>份(<%= link_to "看看都吃了些啥", user_url(current_user), :target => :_blank, :class => :h %>)
          <% end %>
        </div>
      </div>
    </div>
  </div>
</div>
<%= render :file => 'homes/_guild.html' %>